package com.itheima.controller;

import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


@RestController
@Slf4j
@RequestMapping("/report")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /**
     * 统计各个职位的员工个数
     * @return
     */
    @GetMapping("/empJobData")
    public Result  empJobData(){
        log.info("查询员工数据");
        //1.调用业务逻辑层查询数据
        JobOption jobOption = reportService.empJobData();
        //2.返回结果
        return Result.success(jobOption);
    }

    /**
     * 统计员工信息性别数据
     * @return
     */
    @GetMapping("/empGenderData")
    public Result  empGenderData(){
        log.info("查询员工数据");
       //1.调用业务逻辑层查询数据
        List<Map<String,Object>> list = reportService.empGenderData();
        //2.返回结果
        return Result.success(list);
    }
}
